/*
 *    Copyright © OpenAtom Foundation.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.inspur.edp.bef.dtgenerator.repository;

import com.inspur.edp.bef.dtgenerator.BEGeneratorContext;
import com.inspur.edp.bef.dtgenerator.repository.assembler.BEMainEntityAssemblerGenerator;
import com.inspur.edp.bef.dtgenerator.repository.assembler.BeExtendEntityAssemblerGenerator;
import com.inspur.edp.cef.generator.repository.base.CefRepoGenCtx;
import com.inspur.edp.cef.generator.repository.entity.CommonModelRepoGenerator;
import com.inspur.edp.cef.generator.repository.entity.ExtendEntityAssemblerGenerator;
import com.inspur.edp.cef.generator.repository.entity.MainEntityAssemblerGenerator;
import com.inspur.edp.das.commonmodel.IGspCommonObject;

public class BeRepositoryGenerator extends CommonModelRepoGenerator {
  private BEGeneratorContext beGenCtx;

  public BeRepositoryGenerator(BEGeneratorContext beGenCtx) {
    super(beGenCtx, beGenCtx.getBE());
    this.beGenCtx = beGenCtx;
  }

// keyword:
  // ORIGINAL LINE: private new  beRepositoryGenCtxgetContext() { return
  // (BeRepositoryGenCtx)super.getContext(); }
  @Override
  protected BeRepositoryGenCtx getContext() {
    return (BeRepositoryGenCtx) super.getContext();
  }

  @Override
  protected CefRepoGenCtx getRepoGenCtx() {
    BeRepositoryGenCtx ctx = new BeRepositoryGenCtx(beGenCtx);
    ctx.setDefaultNameSpace(getPackageName());
    return ctx;
  }

  @Override
  protected ExtendEntityAssemblerGenerator getExtendEntityAssGenerator(IGspCommonObject cmObject) {
    return new BeExtendEntityAssemblerGenerator(getContext(), beGenCtx.getBE().getMainObject());
  }

  @Override
  protected MainEntityAssemblerGenerator getMainEntityAssmeblerGenerator(
      IGspCommonObject cmObject) {
    return new BEMainEntityAssemblerGenerator(getContext(), beGenCtx.getBE().getMainObject());
  }
}
